import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code1 {
    public static int count;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt();
        int r = in.nextInt();
        count = 0;
        for(int i=l;i<=r;i++) {
            getCount(i);
        }
        System.out.println(count);
    }
    private static void getCount(int x) {
        while(x != 0) {
            if((x % 10) == 2) count++;
            x /= 10;
        }
    }

}